﻿namespace Viz
{
    using Microsoft.Xna.Framework;
    using Microsoft.Xna.Framework.Graphics;

    public struct Vertex3Color
    {
        public Vector3                                  Position;
        public Color                                    Color;

        public Vertex3Color(
            Vector3                                     position, 
            Color                                       color
        )
        {
            Position = position;
            Color = color;
        }

        public static readonly VertexDeclaration VertexDeclaration = new VertexDeclaration(
            new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0),
            new VertexElement(12, VertexElementFormat.Color, VertexElementUsage.Color, 0));
    }

    public class TextureUV
    {
        public static Vector2 TopLeft = new Vector2(0.0f, 0.0f);
        public static Vector2 TopRight = new Vector2(1.0f, 0.0f);
        public static Vector2 BottomLeft = new Vector2(0.0f, 1.0f);
        public static Vector2 BottomRight = new Vector2(1.0f, 1.0f);
    }

    public static class ExTools
    {
        public static Color ToColor(this System.Windows.Media.Color c)
        {
            return new Color((float) (c.R), (float) (c.G), (float) (c.B), (float) c.A);
        }

        public static System.Windows.Media.Color ToColor(this Color c)
        {
            return System.Windows.Media.Color.FromArgb(c.A, (byte) (c.R), (byte) (c.G), (byte) (c.B));
        }
    }
}
